package test.patterns;

// http://www.avajava.com/tutorials/lessons/command-pattern.html?page=1

public class CmdDemo {

	public static void main(String[] args) {

		CmdLunch lunch = new CmdLunch(); // receiver
		CmdCommand lunchCommand = new CmdLunchCommand(lunch); // concrete command

		CmdDinner dinner = new CmdDinner(); // receiver
		CmdCommand dinnerCommand = new CmdDinnerCommand(dinner); // concrete command

		CmdMealInvoker mealInvoker = new CmdMealInvoker(lunchCommand); // invoker
		mealInvoker.invoke();

		mealInvoker.setCommand(dinnerCommand);
		mealInvoker.invoke();

	}

}